package com.woniu.controller;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniu.pojo.House;
import com.woniu.pojo.Houses;
import com.woniu.service.HouseService;

@Controller
@RequestMapping("/house")
public class HouseController {
	@Autowired
	private HouseService houseService;
	@RequestMapping("/addHouse")
	@ResponseBody
	public String addHouse(House house,HttpSession session) {
		Houses houses= (Houses) session.getAttribute("houses");
		house.setHs_id(houses.getHs_id());
		int addHouse = houseService.addHouse(house);
		if(addHouse>0) {
			
			return "添加成功！";
		}else {
			return "添加失败！";
		}
	}
	@RequestMapping("/selectHouseById")
	@ResponseBody
	public House selectHouseById(String house_id) {
		House house = houseService.selectHouseById(house_id);
		return house;
	}
	
}
